#include "Spline.h"

void spline::sort() // resorting to Bubble Sort
{
bool swapped;
swapped = true;
while(swapped == true) // do while true
{
    swapped = false; // set to false to make it sort and for final run through
    for (int i =1 ; i < order; i++)
    {
        if (coordinates[i-1].x > coordinates [i].x) // checking x's
        {
            coordinate temp = coordinates[i-1]; // placing in temp
            coordinates[i-1] = coordinates [i]; // replacing the lesser
            coordinates[i] = temp; // replacing the greater value
            swapped = true; // have it loop until no swaps
        }
    }
}
for (int i = 0; i < order; i++)
    {
        cout << "Points Sort: <" <<  coordinates[i].x << "," << coordinates[i].y << ">"<< endl;
    }
}
        

/*void spline::sort()
{
    spline::temp = new coordinate[order]; 
    bool check = false;
    
    
    
    //populating x

    
    for (int i = 0; i < order; i++)
    {
        cout << "Points Sort: <" <<  coordinates[i].x << "," << coordinates[i].y << ">"<< endl;
    }
}*/
